package org.seamon.management.sms;

import jakarta.annotation.Resource;
import lombok.RequiredArgsConstructor;
import org.seamon.management.config.RabbitConfig;
import org.seamon.management.pojo.entity.SmsTask;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Simon
 */
@Service
@RequiredArgsConstructor
public class SmsProducer {

    @Resource
    private RabbitTemplate rabbitTemplate;

    public void send(List<SmsTask> smsTasks) {
        // 发送到 RabbitMQ
        rabbitTemplate.convertAndSend(RabbitConfig.SMS_BATCH_QUEUE, smsTasks);
    }
}
